
-- --------------------------------------------------
-- Entity Designer DDL Script for SQL Server 2005, 2008, and Azure
-- --------------------------------------------------
-- Date Created: 06/22/2012 17:23:46
-- Generated from EDMX file: C:\Users\Eldred\Desktop\MTI\NET\Projet\epita-gamewebclient\NetHeavyClient\DataAccess\EF\GameEntities.edmx
-- --------------------------------------------------

SET QUOTED_IDENTIFIER OFF;
GO
USE [plic-jv-2013];
GO
IF SCHEMA_ID(N'dbo') IS NULL EXECUTE(N'CREATE SCHEMA [dbo]');
GO

-- --------------------------------------------------
-- Dropping existing FOREIGN KEY constraints
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[FK_ArmySquad]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SquadJeu] DROP CONSTRAINT [FK_ArmySquad];
GO
IF OBJECT_ID(N'[dbo].[FK_CityEntitySlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[UnitSlotJeu] DROP CONSTRAINT [FK_CityEntitySlot];
GO
IF OBJECT_ID(N'[dbo].[FK_PlayerArmy]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PlayerJeu] DROP CONSTRAINT [FK_PlayerArmy];
GO
IF OBJECT_ID(N'[dbo].[FK_CityResources]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[CityJeu] DROP CONSTRAINT [FK_CityResources];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingProducesResources]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ResourcesJeu] DROP CONSTRAINT [FK_BuildingProducesResources];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingReinforcementResources]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingJeu] DROP CONSTRAINT [FK_BuildingReinforcementResources];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingProductionCapacity]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ProductionCapacityJeu] DROP CONSTRAINT [FK_BuildingProductionCapacity];
GO
IF OBJECT_ID(N'[dbo].[FK_SkillSkillType]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SkillJeu] DROP CONSTRAINT [FK_SkillSkillType];
GO
IF OBJECT_ID(N'[dbo].[FK_PlayerCity]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PlayerJeu] DROP CONSTRAINT [FK_PlayerCity];
GO
IF OBJECT_ID(N'[dbo].[FK_UnitRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[UnitTypeJeu] DROP CONSTRAINT [FK_UnitRace];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingJeu] DROP CONSTRAINT [FK_BuildingRace];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingBuildingStatistics]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingJeu] DROP CONSTRAINT [FK_BuildingBuildingStatistics];
GO
IF OBJECT_ID(N'[dbo].[FK_UnitUnitStatistics]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[UnitTypeJeu] DROP CONSTRAINT [FK_UnitUnitStatistics];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingBuildingType]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingJeu] DROP CONSTRAINT [FK_BuildingBuildingType];
GO
IF OBJECT_ID(N'[dbo].[FK_UnitUnitSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[UnitSlotJeu] DROP CONSTRAINT [FK_UnitUnitSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_SquadSlotUnit]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SquadSlotJeu] DROP CONSTRAINT [FK_SquadSlotUnit];
GO
IF OBJECT_ID(N'[dbo].[FK_SquadSquadSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[SquadSlotJeu] DROP CONSTRAINT [FK_SquadSquadSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_BuildingSlotBuilding]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingSlotJeu] DROP CONSTRAINT [FK_BuildingSlotBuilding];
GO
IF OBJECT_ID(N'[dbo].[FK_CityBuildingSlot]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[BuildingSlotJeu] DROP CONSTRAINT [FK_CityBuildingSlot];
GO
IF OBJECT_ID(N'[dbo].[FK_AccountPlayer]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[AccountJeu] DROP CONSTRAINT [FK_AccountPlayer];
GO
IF OBJECT_ID(N'[dbo].[FK_ProductionCapacityUnitType]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[ProductionCapacityJeu] DROP CONSTRAINT [FK_ProductionCapacityUnitType];
GO
IF OBJECT_ID(N'[dbo].[FK_UnitTypePrice]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[UnitTypeJeu] DROP CONSTRAINT [FK_UnitTypePrice];
GO
IF OBJECT_ID(N'[dbo].[FK_PlayerRace]', 'F') IS NOT NULL
    ALTER TABLE [dbo].[PlayerJeu] DROP CONSTRAINT [FK_PlayerRace];
GO

-- --------------------------------------------------
-- Dropping existing tables
-- --------------------------------------------------

IF OBJECT_ID(N'[dbo].[ResourcesJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ResourcesJeu];
GO
IF OBJECT_ID(N'[dbo].[ProductionCapacityJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ProductionCapacityJeu];
GO
IF OBJECT_ID(N'[dbo].[UnitSlotJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[UnitSlotJeu];
GO
IF OBJECT_ID(N'[dbo].[SkillJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SkillJeu];
GO
IF OBJECT_ID(N'[dbo].[SkillTypeJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SkillTypeJeu];
GO
IF OBJECT_ID(N'[dbo].[RaceJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[RaceJeu];
GO
IF OBJECT_ID(N'[dbo].[SquadJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SquadJeu];
GO
IF OBJECT_ID(N'[dbo].[ArmyJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[ArmyJeu];
GO
IF OBJECT_ID(N'[dbo].[CityJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[CityJeu];
GO
IF OBJECT_ID(N'[dbo].[PlayerJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[PlayerJeu];
GO
IF OBJECT_ID(N'[dbo].[UnitTypeJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[UnitTypeJeu];
GO
IF OBJECT_ID(N'[dbo].[BuildingJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BuildingJeu];
GO
IF OBJECT_ID(N'[dbo].[UnitStatisticsJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[UnitStatisticsJeu];
GO
IF OBJECT_ID(N'[dbo].[BuildingStatisticsJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BuildingStatisticsJeu];
GO
IF OBJECT_ID(N'[dbo].[BuildingTypeJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BuildingTypeJeu];
GO
IF OBJECT_ID(N'[dbo].[SquadSlotJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[SquadSlotJeu];
GO
IF OBJECT_ID(N'[dbo].[BuildingSlotJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[BuildingSlotJeu];
GO
IF OBJECT_ID(N'[dbo].[AccountJeu]', 'U') IS NOT NULL
    DROP TABLE [dbo].[AccountJeu];
GO

-- --------------------------------------------------
-- Creating all tables
-- --------------------------------------------------

-- Creating table 'ResourcesJeu'
CREATE TABLE [dbo].[ResourcesJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Gold] int  NOT NULL,
    [Wood] int  NOT NULL,
    [Stone] int  NOT NULL,
    [Food] int  NOT NULL,
    [BuildingProducesResources_Resources_ID] int  NULL
);
GO

-- Creating table 'ProductionCapacityJeu'
CREATE TABLE [dbo].[ProductionCapacityJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Number] smallint  NOT NULL,
    [Building_ID] int  NOT NULL,
    [UnitType_ID] int  NOT NULL
);
GO

-- Creating table 'UnitSlotJeu'
CREATE TABLE [dbo].[UnitSlotJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [CityID] int  NOT NULL,
    [Number] int  NOT NULL,
    [Unit_ID] int  NOT NULL
);
GO

-- Creating table 'SkillJeu'
CREATE TABLE [dbo].[SkillJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Power] int  NOT NULL,
    [Cost] int  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [MaxRange] int  NOT NULL,
    [MinRange] int  NOT NULL,
    [Dodgeable] bit  NOT NULL,
    [SkillType_ID] int  NOT NULL
);
GO

-- Creating table 'SkillTypeJeu'
CREATE TABLE [dbo].[SkillTypeJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'RaceJeu'
CREATE TABLE [dbo].[RaceJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'SquadJeu'
CREATE TABLE [dbo].[SquadJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [PointValue] int  NOT NULL,
    [ArmyID] int  NOT NULL
);
GO

-- Creating table 'ArmyJeu'
CREATE TABLE [dbo].[ArmyJeu] (
    [ID] int IDENTITY(1,1) NOT NULL
);
GO

-- Creating table 'CityJeu'
CREATE TABLE [dbo].[CityJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [PlayerID] int  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Resources_ID] int  NULL
);
GO

-- Creating table 'PlayerJeu'
CREATE TABLE [dbo].[PlayerJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Army_ID] int  NOT NULL,
    [City_ID] int  NOT NULL,
    [Race_ID] int  NOT NULL
);
GO

-- Creating table 'UnitTypeJeu'
CREATE TABLE [dbo].[UnitTypeJeu] (
    [ID] int  NOT NULL,
    [Name] nvarchar(max)  NOT NULL,
    [Race_ID] int  NOT NULL,
    [Statistics_ID] int  NOT NULL,
    [Price_ID] int  NOT NULL
);
GO

-- Creating table 'BuildingJeu'
CREATE TABLE [dbo].[BuildingJeu] (
    [Reinforced] bit  NOT NULL,
    [MoraleEffect] int  NOT NULL,
    [ID] int  NOT NULL,
    [ResourcesReinforcement_ID] int  NOT NULL,
    [Race_ID] int  NOT NULL,
    [BuildingStatistics_ID] int  NOT NULL,
    [BuildingType_ID] int  NOT NULL
);
GO

-- Creating table 'UnitStatisticsJeu'
CREATE TABLE [dbo].[UnitStatisticsJeu] (
    [Attack] int  NOT NULL,
    [Defense] int  NOT NULL,
    [Speed] int  NOT NULL,
    [Dexterity] int  NOT NULL,
    [MaxRange] int  NOT NULL,
    [MinRange] int  NOT NULL,
    [ID] int  NOT NULL,
    [ProductionTime] int  NOT NULL,
    [MaxHP] int  NOT NULL
);
GO

-- Creating table 'BuildingStatisticsJeu'
CREATE TABLE [dbo].[BuildingStatisticsJeu] (
    [ID] int  NOT NULL,
    [MaxHP] int  NOT NULL,
    [ProductionTime] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'BuildingTypeJeu'
CREATE TABLE [dbo].[BuildingTypeJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Name] nvarchar(max)  NOT NULL
);
GO

-- Creating table 'SquadSlotJeu'
CREATE TABLE [dbo].[SquadSlotJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [SquadID] int  NOT NULL,
    [Column] int  NOT NULL,
    [Line] int  NOT NULL,
    [SquadID1] int  NOT NULL,
    [Unit_ID] int  NOT NULL
);
GO

-- Creating table 'BuildingSlotJeu'
CREATE TABLE [dbo].[BuildingSlotJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [Disabled] bit  NOT NULL,
    [State] int  NOT NULL,
    [CityID] int  NOT NULL,
    [Building_ID] int  NOT NULL
);
GO

-- Creating table 'AccountJeu'
CREATE TABLE [dbo].[AccountJeu] (
    [ID] int IDENTITY(1,1) NOT NULL,
    [EMail] nvarchar(max)  NOT NULL,
    [Password] nvarchar(max)  NOT NULL,
    [Login] nvarchar(max)  NOT NULL,
    [Player_ID] int  NOT NULL
);
GO

-- --------------------------------------------------
-- Creating all PRIMARY KEY constraints
-- --------------------------------------------------

-- Creating primary key on [ID] in table 'ResourcesJeu'
ALTER TABLE [dbo].[ResourcesJeu]
ADD CONSTRAINT [PK_ResourcesJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'ProductionCapacityJeu'
ALTER TABLE [dbo].[ProductionCapacityJeu]
ADD CONSTRAINT [PK_ProductionCapacityJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'UnitSlotJeu'
ALTER TABLE [dbo].[UnitSlotJeu]
ADD CONSTRAINT [PK_UnitSlotJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'SkillJeu'
ALTER TABLE [dbo].[SkillJeu]
ADD CONSTRAINT [PK_SkillJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'SkillTypeJeu'
ALTER TABLE [dbo].[SkillTypeJeu]
ADD CONSTRAINT [PK_SkillTypeJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'RaceJeu'
ALTER TABLE [dbo].[RaceJeu]
ADD CONSTRAINT [PK_RaceJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'SquadJeu'
ALTER TABLE [dbo].[SquadJeu]
ADD CONSTRAINT [PK_SquadJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'ArmyJeu'
ALTER TABLE [dbo].[ArmyJeu]
ADD CONSTRAINT [PK_ArmyJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'CityJeu'
ALTER TABLE [dbo].[CityJeu]
ADD CONSTRAINT [PK_CityJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'PlayerJeu'
ALTER TABLE [dbo].[PlayerJeu]
ADD CONSTRAINT [PK_PlayerJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'UnitTypeJeu'
ALTER TABLE [dbo].[UnitTypeJeu]
ADD CONSTRAINT [PK_UnitTypeJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'BuildingJeu'
ALTER TABLE [dbo].[BuildingJeu]
ADD CONSTRAINT [PK_BuildingJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'UnitStatisticsJeu'
ALTER TABLE [dbo].[UnitStatisticsJeu]
ADD CONSTRAINT [PK_UnitStatisticsJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'BuildingStatisticsJeu'
ALTER TABLE [dbo].[BuildingStatisticsJeu]
ADD CONSTRAINT [PK_BuildingStatisticsJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'BuildingTypeJeu'
ALTER TABLE [dbo].[BuildingTypeJeu]
ADD CONSTRAINT [PK_BuildingTypeJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'SquadSlotJeu'
ALTER TABLE [dbo].[SquadSlotJeu]
ADD CONSTRAINT [PK_SquadSlotJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'BuildingSlotJeu'
ALTER TABLE [dbo].[BuildingSlotJeu]
ADD CONSTRAINT [PK_BuildingSlotJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- Creating primary key on [ID] in table 'AccountJeu'
ALTER TABLE [dbo].[AccountJeu]
ADD CONSTRAINT [PK_AccountJeu]
    PRIMARY KEY CLUSTERED ([ID] ASC);
GO

-- --------------------------------------------------
-- Creating all FOREIGN KEY constraints
-- --------------------------------------------------

-- Creating foreign key on [ArmyID] in table 'SquadJeu'
ALTER TABLE [dbo].[SquadJeu]
ADD CONSTRAINT [FK_ArmySquad]
    FOREIGN KEY ([ArmyID])
    REFERENCES [dbo].[ArmyJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ArmySquad'
CREATE INDEX [IX_FK_ArmySquad]
ON [dbo].[SquadJeu]
    ([ArmyID]);
GO

-- Creating foreign key on [CityID] in table 'UnitSlotJeu'
ALTER TABLE [dbo].[UnitSlotJeu]
ADD CONSTRAINT [FK_CityEntitySlot]
    FOREIGN KEY ([CityID])
    REFERENCES [dbo].[CityJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CityEntitySlot'
CREATE INDEX [IX_FK_CityEntitySlot]
ON [dbo].[UnitSlotJeu]
    ([CityID]);
GO

-- Creating foreign key on [Army_ID] in table 'PlayerJeu'
ALTER TABLE [dbo].[PlayerJeu]
ADD CONSTRAINT [FK_PlayerArmy]
    FOREIGN KEY ([Army_ID])
    REFERENCES [dbo].[ArmyJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PlayerArmy'
CREATE INDEX [IX_FK_PlayerArmy]
ON [dbo].[PlayerJeu]
    ([Army_ID]);
GO

-- Creating foreign key on [Resources_ID] in table 'CityJeu'
ALTER TABLE [dbo].[CityJeu]
ADD CONSTRAINT [FK_CityResources]
    FOREIGN KEY ([Resources_ID])
    REFERENCES [dbo].[ResourcesJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CityResources'
CREATE INDEX [IX_FK_CityResources]
ON [dbo].[CityJeu]
    ([Resources_ID]);
GO

-- Creating foreign key on [BuildingProducesResources_Resources_ID] in table 'ResourcesJeu'
ALTER TABLE [dbo].[ResourcesJeu]
ADD CONSTRAINT [FK_BuildingProducesResources]
    FOREIGN KEY ([BuildingProducesResources_Resources_ID])
    REFERENCES [dbo].[BuildingJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingProducesResources'
CREATE INDEX [IX_FK_BuildingProducesResources]
ON [dbo].[ResourcesJeu]
    ([BuildingProducesResources_Resources_ID]);
GO

-- Creating foreign key on [ResourcesReinforcement_ID] in table 'BuildingJeu'
ALTER TABLE [dbo].[BuildingJeu]
ADD CONSTRAINT [FK_BuildingReinforcementResources]
    FOREIGN KEY ([ResourcesReinforcement_ID])
    REFERENCES [dbo].[ResourcesJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingReinforcementResources'
CREATE INDEX [IX_FK_BuildingReinforcementResources]
ON [dbo].[BuildingJeu]
    ([ResourcesReinforcement_ID]);
GO

-- Creating foreign key on [Building_ID] in table 'ProductionCapacityJeu'
ALTER TABLE [dbo].[ProductionCapacityJeu]
ADD CONSTRAINT [FK_BuildingProductionCapacity]
    FOREIGN KEY ([Building_ID])
    REFERENCES [dbo].[BuildingJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingProductionCapacity'
CREATE INDEX [IX_FK_BuildingProductionCapacity]
ON [dbo].[ProductionCapacityJeu]
    ([Building_ID]);
GO

-- Creating foreign key on [SkillType_ID] in table 'SkillJeu'
ALTER TABLE [dbo].[SkillJeu]
ADD CONSTRAINT [FK_SkillSkillType]
    FOREIGN KEY ([SkillType_ID])
    REFERENCES [dbo].[SkillTypeJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SkillSkillType'
CREATE INDEX [IX_FK_SkillSkillType]
ON [dbo].[SkillJeu]
    ([SkillType_ID]);
GO

-- Creating foreign key on [City_ID] in table 'PlayerJeu'
ALTER TABLE [dbo].[PlayerJeu]
ADD CONSTRAINT [FK_PlayerCity]
    FOREIGN KEY ([City_ID])
    REFERENCES [dbo].[CityJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PlayerCity'
CREATE INDEX [IX_FK_PlayerCity]
ON [dbo].[PlayerJeu]
    ([City_ID]);
GO

-- Creating foreign key on [Race_ID] in table 'UnitTypeJeu'
ALTER TABLE [dbo].[UnitTypeJeu]
ADD CONSTRAINT [FK_UnitRace]
    FOREIGN KEY ([Race_ID])
    REFERENCES [dbo].[RaceJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_UnitRace'
CREATE INDEX [IX_FK_UnitRace]
ON [dbo].[UnitTypeJeu]
    ([Race_ID]);
GO

-- Creating foreign key on [Race_ID] in table 'BuildingJeu'
ALTER TABLE [dbo].[BuildingJeu]
ADD CONSTRAINT [FK_BuildingRace]
    FOREIGN KEY ([Race_ID])
    REFERENCES [dbo].[RaceJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingRace'
CREATE INDEX [IX_FK_BuildingRace]
ON [dbo].[BuildingJeu]
    ([Race_ID]);
GO

-- Creating foreign key on [BuildingStatistics_ID] in table 'BuildingJeu'
ALTER TABLE [dbo].[BuildingJeu]
ADD CONSTRAINT [FK_BuildingBuildingStatistics]
    FOREIGN KEY ([BuildingStatistics_ID])
    REFERENCES [dbo].[BuildingStatisticsJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingBuildingStatistics'
CREATE INDEX [IX_FK_BuildingBuildingStatistics]
ON [dbo].[BuildingJeu]
    ([BuildingStatistics_ID]);
GO

-- Creating foreign key on [Statistics_ID] in table 'UnitTypeJeu'
ALTER TABLE [dbo].[UnitTypeJeu]
ADD CONSTRAINT [FK_UnitUnitStatistics]
    FOREIGN KEY ([Statistics_ID])
    REFERENCES [dbo].[UnitStatisticsJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_UnitUnitStatistics'
CREATE INDEX [IX_FK_UnitUnitStatistics]
ON [dbo].[UnitTypeJeu]
    ([Statistics_ID]);
GO

-- Creating foreign key on [BuildingType_ID] in table 'BuildingJeu'
ALTER TABLE [dbo].[BuildingJeu]
ADD CONSTRAINT [FK_BuildingBuildingType]
    FOREIGN KEY ([BuildingType_ID])
    REFERENCES [dbo].[BuildingTypeJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingBuildingType'
CREATE INDEX [IX_FK_BuildingBuildingType]
ON [dbo].[BuildingJeu]
    ([BuildingType_ID]);
GO

-- Creating foreign key on [Unit_ID] in table 'UnitSlotJeu'
ALTER TABLE [dbo].[UnitSlotJeu]
ADD CONSTRAINT [FK_UnitUnitSlot]
    FOREIGN KEY ([Unit_ID])
    REFERENCES [dbo].[UnitTypeJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_UnitUnitSlot'
CREATE INDEX [IX_FK_UnitUnitSlot]
ON [dbo].[UnitSlotJeu]
    ([Unit_ID]);
GO

-- Creating foreign key on [Unit_ID] in table 'SquadSlotJeu'
ALTER TABLE [dbo].[SquadSlotJeu]
ADD CONSTRAINT [FK_SquadSlotUnit]
    FOREIGN KEY ([Unit_ID])
    REFERENCES [dbo].[UnitTypeJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SquadSlotUnit'
CREATE INDEX [IX_FK_SquadSlotUnit]
ON [dbo].[SquadSlotJeu]
    ([Unit_ID]);
GO

-- Creating foreign key on [Building_ID] in table 'BuildingSlotJeu'
ALTER TABLE [dbo].[BuildingSlotJeu]
ADD CONSTRAINT [FK_BuildingSlotBuilding]
    FOREIGN KEY ([Building_ID])
    REFERENCES [dbo].[BuildingJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_BuildingSlotBuilding'
CREATE INDEX [IX_FK_BuildingSlotBuilding]
ON [dbo].[BuildingSlotJeu]
    ([Building_ID]);
GO

-- Creating foreign key on [CityID] in table 'BuildingSlotJeu'
ALTER TABLE [dbo].[BuildingSlotJeu]
ADD CONSTRAINT [FK_CityBuildingSlot]
    FOREIGN KEY ([CityID])
    REFERENCES [dbo].[CityJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_CityBuildingSlot'
CREATE INDEX [IX_FK_CityBuildingSlot]
ON [dbo].[BuildingSlotJeu]
    ([CityID]);
GO

-- Creating foreign key on [Player_ID] in table 'AccountJeu'
ALTER TABLE [dbo].[AccountJeu]
ADD CONSTRAINT [FK_AccountPlayer]
    FOREIGN KEY ([Player_ID])
    REFERENCES [dbo].[PlayerJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_AccountPlayer'
CREATE INDEX [IX_FK_AccountPlayer]
ON [dbo].[AccountJeu]
    ([Player_ID]);
GO

-- Creating foreign key on [UnitType_ID] in table 'ProductionCapacityJeu'
ALTER TABLE [dbo].[ProductionCapacityJeu]
ADD CONSTRAINT [FK_ProductionCapacityUnitType]
    FOREIGN KEY ([UnitType_ID])
    REFERENCES [dbo].[UnitTypeJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_ProductionCapacityUnitType'
CREATE INDEX [IX_FK_ProductionCapacityUnitType]
ON [dbo].[ProductionCapacityJeu]
    ([UnitType_ID]);
GO

-- Creating foreign key on [Price_ID] in table 'UnitTypeJeu'
ALTER TABLE [dbo].[UnitTypeJeu]
ADD CONSTRAINT [FK_UnitTypePrice]
    FOREIGN KEY ([Price_ID])
    REFERENCES [dbo].[ResourcesJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_UnitTypePrice'
CREATE INDEX [IX_FK_UnitTypePrice]
ON [dbo].[UnitTypeJeu]
    ([Price_ID]);
GO

-- Creating foreign key on [Race_ID] in table 'PlayerJeu'
ALTER TABLE [dbo].[PlayerJeu]
ADD CONSTRAINT [FK_PlayerRace]
    FOREIGN KEY ([Race_ID])
    REFERENCES [dbo].[RaceJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_PlayerRace'
CREATE INDEX [IX_FK_PlayerRace]
ON [dbo].[PlayerJeu]
    ([Race_ID]);
GO

-- Creating foreign key on [SquadID1] in table 'SquadSlotJeu'
ALTER TABLE [dbo].[SquadSlotJeu]
ADD CONSTRAINT [FK_SquadSquadSlot]
    FOREIGN KEY ([SquadID1])
    REFERENCES [dbo].[SquadJeu]
        ([ID])
    ON DELETE NO ACTION ON UPDATE NO ACTION;

-- Creating non-clustered index for FOREIGN KEY 'FK_SquadSquadSlot'
CREATE INDEX [IX_FK_SquadSquadSlot]
ON [dbo].[SquadSlotJeu]
    ([SquadID1]);
GO

-- --------------------------------------------------
-- Script has ended
-- --------------------------------------------------